home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / Universal Headers 2.0.1f / ENET.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-22  |  4.3 KB  |  153 lines  |  [TEXT/MMCC]

  1. /*
  2.      File:        ENET.h
  3.  
  4.      Contains:    Ethernet Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __ENET__
  21. #define __ENET__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __OSUTILS__
  30. #include <OSUtils.h>
  31. #endif
  32. /*    #include <MixedMode.h>                                        */
  33. /*    #include <Memory.h>                                            */
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_ALIGN_SUPPORTED
  40. #pragma options align=mac68k
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT_SUPPORTED
  44. #pragma import on
  45. #endif
  46.  
  47.  
  48. enum {
  49.     ENetSetGeneral                = 253,                            /*Set "general" mode*/
  50.     ENetGetInfo                    = 252,                            /*Get info*/
  51.     ENetRdCancel                = 251,                            /*Cancel read*/
  52.     ENetRead                    = 250,                            /*Read*/
  53.     ENetWrite                    = 249,                            /*Write*/
  54.     ENetDetachPH                = 248,                            /*Detach protocol handler*/
  55.     ENetAttachPH                = 247,                            /*Attach protocol handler*/
  56.     ENetAddMulti                = 246,                            /*Add a multicast address*/
  57.     ENetDelMulti                = 245,                            /*Delete a multicast address*/
  58.     EAddrRType                    = 'eadr'
  59. };
  60.  
  61. typedef struct EParamBlock EParamBlock, *EParamBlkPtr;
  62.  
  63. /*
  64.         ENETCompletionProcPtr uses register based parameters on the 68k and cannot
  65.         be written in or called from a high-level language without the help of
  66.         mixed mode or assembly glue.
  67.  
  68.             typedef pascal void (*ENETCompletionProcPtr)(EParamBlkPtr thePBPtr);
  69.  
  70.         In:
  71.          => thePBPtr        A0.L
  72. */
  73.  
  74. #if GENERATINGCFM
  75. typedef UniversalProcPtr ENETCompletionUPP;
  76. #else
  77. typedef Register68kProcPtr ENETCompletionUPP;
  78. #endif
  79.  
  80. struct EParamMisc1 {
  81.     short                            eProtType;                    /*Ethernet protocol type*/
  82.     Ptr                                ePointer;                    /*No support for PowerPC code*/
  83.     short                            eBuffSize;                    /*buffer size*/
  84.     short                            eDataSize;                    /*number of bytes read*/
  85. };
  86. typedef struct EParamMisc1 EParamMisc1, *EParamMisc1Ptr;
  87.  
  88. struct EParamMisc2 {
  89.     char                            eMultiAddr[6];                /*Multicast Address*/
  90. };
  91. typedef struct EParamMisc2 EParamMisc2, *EParamMisc2Ptr;
  92.  
  93. struct EParamBlock {
  94.     QElem                            *qLink;                        /*General EParams*/
  95.     short                            qType;                        /*queue type*/
  96.     short                            ioTrap;                        /*routine trap*/
  97.     Ptr                                ioCmdAddr;                    /*routine address*/
  98.     ENETCompletionUPP                ioCompletion;                /*completion routine*/
  99.     OSErr                            ioResult;                    /*result code*/
  100.     StringPtr                        ioNamePtr;                    /*->filename*/
  101.     short                            ioVRefNum;                    /*volume reference or drive number*/
  102.     short                            ioRefNum;                    /*driver reference number*/
  103.     short                            csCode;                        /*Call command code*/
  104.     union {
  105.         EParamMisc1                        EParms1;
  106.         EParamMisc2                        EParms2;
  107.     } u;
  108. };
  109.  
  110. enum {
  111.     uppENETCompletionProcInfo = kRegisterBased
  112.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(EParamBlkPtr)))
  113. };
  114.  
  115. #if GENERATINGCFM
  116. #define CallENETCompletionProc(userRoutine, thePBPtr)        \
  117.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppENETCompletionProcInfo, (thePBPtr))
  118. #else
  119. /* (*ENETCompletionProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  120. #endif
  121.  
  122. #if GENERATINGCFM
  123. #define NewENETCompletionProc(userRoutine)        \
  124.         (ENETCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppENETCompletionProcInfo, GetCurrentArchitecture())
  125. #else
  126. #define NewENETCompletionProc(userRoutine)        \
  127.         ((ENETCompletionUPP) (userRoutine))
  128. #endif
  129.  
  130. extern pascal OSErr EWrite(EParamBlkPtr thePBptr, Boolean async);
  131. extern pascal OSErr EAttachPH(EParamBlkPtr thePBptr, Boolean async);
  132. extern pascal OSErr EDetachPH(EParamBlkPtr thePBptr, Boolean async);
  133. extern pascal OSErr ERead(EParamBlkPtr thePBptr, Boolean async);
  134. extern pascal OSErr ERdCancel(EParamBlkPtr thePBptr, Boolean async);
  135. extern pascal OSErr EGetInfo(EParamBlkPtr thePBptr, Boolean async);
  136. extern pascal OSErr ESetGeneral(EParamBlkPtr thePBptr, Boolean async);
  137. extern pascal OSErr EAddMulti(EParamBlkPtr thePBptr, Boolean async);
  138. extern pascal OSErr EDelMulti(EParamBlkPtr thePBptr, Boolean async);
  139.  
  140. #if PRAGMA_IMPORT_SUPPORTED
  141. #pragma import off
  142. #endif
  143.  
  144. #if PRAGMA_ALIGN_SUPPORTED
  145. #pragma options align=reset
  146. #endif
  147.  
  148. #ifdef __cplusplus
  149. }
  150. #endif
  151.  
  152. #endif /* __ENET__ */
  153.